package practice;

import java.util.Scanner;

public class _15GGame {
    static int n;
    static int[] a;
    static int p;
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        n = scanner.nextInt();
        p = scanner.nextInt();
        a = new int[n];
        for (int i = 0;i < n;i++){
            a[i] = scanner.nextInt();
        }
        scanner.close();

        //  f(i,j) = f(i-1,j) + a[i] * f(i-1,j-1);
        long[] f = new long[n+1];
        f[0] = 1;
        for (int i = 0;i < a.length;i++){
            for (int j = n;j >= 1;j--){
                f[j] = (f[j] + f[j-1]*a[i])%p;
            }
        }
        for (int i = 0;i <= n;i++){
            System.out.print(f[i] + " ");
        }
    }
}
